home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_olv_head1.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  454 lines

  1. # Jones 3D Cog Script
  2. #
  3. #    olv_head1.cog
  4. #
  5. # Cog to roll head 1.
  6. #
  7. # [DS & revised by HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ==============================================================================
  12.  
  13. Symbols
  14.  
  15.     message        startup
  16.        message        entered
  17.     message        exited
  18.     message        touched
  19.     message        blocked
  20.     message        timer
  21.     message        pulse
  22.  
  23.     thing        player                                    local 
  24.  
  25.     thing        head1a
  26.     thing        head1b
  27.     thing        pushblock
  28.     thing        crumble0                                nolink
  29.     thing        crumble1                                nolink
  30.     thing        crumble2                                nolink
  31.     thing        crumble3                                nolink
  32.     thing        campos                                    nolink
  33.     thing        campos2                                    nolink
  34.     thing        head1_cam                                nolink
  35.     thing        head1_ct_1                                nolink
  36.     thing        head1_ct_2                                nolink
  37.  
  38.     thing        cam1spot                                local
  39.     thing        cam1look                                local
  40.  
  41.     template    tpl_ghost=ghost                            local
  42.  
  43.     sector        fallsector 
  44.     sector        safeslot
  45.  
  46.     surface        oops0                                    mask=0x080
  47.     surface        tube0
  48.     surface        past_safeslot
  49.  
  50.     vector        lookvec
  51.  
  52.     keyframe    in_1to4=0in_stand1_bd_4.key                local
  53.     keyframe    in_stand4=0in_stand4.key                local
  54.     keyframe    smashed=in_die_fall.key                    local
  55.     keyframe    fall=in_jump_land_hard.key                local
  56.     keyframe    rolling=olv_rock_head.key                local
  57.  
  58.     sound        plyersnd=ov03j01.wav                    local # "Monumental Olmec head..."
  59.     sound        ungh=inxj011.wav                        local
  60.     sound        Death=tem_temspikes_up_kill_c.wav        local
  61.     sound        release=olv_presswitch_c.wav            local
  62.     sound        headroll=olv_rockhead_roll_c.wav        local
  63.     sound        headland=olv_rockhead_hitearth_c.wav    local
  64.     sound        fallfloor=olv_fallfloor_c.wav            local
  65.     sound        closecall=inxj007a.wav                    local
  66.  
  67.     vector        vec1                                    local
  68.     vector        vec2                                    local
  69.     vector        vec3                                    local
  70.     vector        vec4                                    local
  71.     vector        pushim                                    local
  72.     int            track                                    local
  73.     int            rolled=0                                 local
  74.     int            curcam                                    local
  75.     int            tutch=0                                    local
  76.     int            vibe                                    local
  77.     int            shake                                    local
  78.     int            doshake=0                                local
  79.     int            camexists=0                                local
  80.  
  81.     flex            headsize                                local
  82.     cog            hints                                    # send message when complete 
  83.  
  84. # --------------falling debris--------------------------------------------------
  85.  
  86.     thing        debrispos
  87.     thing        rocks                                    local
  88.     int            i                                        local
  89.     int            numDebris=17                            local
  90.     int            numpulz=0                                local
  91.     template    debris0=stoneshrapa_nc                    local
  92.     template    debris1=stoneshrapb_nc                    local
  93.     template    debris2=stoneshrapc_nc                    local
  94.  
  95.     int        rel                    local
  96.     int        talk                local
  97.     int        rollin                local
  98.     int        rollhead            local
  99.     thing    victim                local
  100.     flex    camera_end            local
  101.     vector    posoffset            local
  102.     vector    angoffset            local        
  103.  
  104.     end
  105.  
  106. # ==============================================================================
  107.  
  108. code
  109.  
  110. # ..............................................................................
  111.  
  112. startup:
  113.  
  114.     player=GetLocalPlayerThing(); 
  115.     SetThingFlags(head1b, 0x80000);
  116.     vec1 = VectorSet(19.35, 9.18382, -0.35);
  117.     vec2 = VectorSet(16.176, 9.12669, -1.3);
  118.     vec3 = VectorSet(15.3381, 9.11226, -2.2);
  119.     vec4 = VectorSet(15.1381, 9.11226, -2.2);
  120.     pushim = VectorSet(0.0, 0.0, -1.0);
  121.     SetThingLight(pushblock, '0.5 0.5 0.4', 0.01, 0.01);
  122.     return;
  123.  
  124. # ..............................................................................
  125.  
  126. entered:
  127.     if ((getsenderRef() == past_safeslot) && (rolled == 0))
  128.     {
  129.         StopThing(player);
  130.         return;
  131.     }
  132.     if ((rolled == 0) && (getsenderref() == oops0) && (getsourceref() == pushblock))
  133.     {
  134.         SetActorFlags(player, 0x200000);
  135.         MakeMeStop();
  136.         StartCutscene(1);
  137.         PlaySoundLocal(fallfloor, 1.0, 0.0, 0x0, 0);
  138.         shake = 1; # mild shake
  139.         doshake = 1; # on pulse, do cam shake
  140.         SetPulse(0.1);
  141.         Sleep(1.0); # shake for 1 sec
  142.         SetPulse(0.0);
  143.         doshake = 0;
  144.         DestroyThing(crumble0);
  145.         DestroyThing(crumble1);
  146.         DestroyThing(crumble2);
  147.         DestroyThing(crumble3);
  148.         setpulse(0.2);
  149.         DetachThing(player);
  150.         sleep(0.1);
  151.         SetSectorThrust(fallsector, pushim, 100.0);
  152.         PlayKey(player, fall, 4, 0x12, 1);
  153.         ClearActorFlags(player, 0x200000);
  154.         EndCutscene();
  155.  
  156.         # Clear now unecessary thrust.
  157.         SetSectorThrust(fallsector, pushim, 0.0);
  158.  
  159.         return;
  160.     }
  161.     if ((getsenderref() == tube0) && (rolled == 0))
  162.     {
  163.         SendMessageEx(hints, user0, 1, 0, 0, 0);    #param0=1; standing on pad.
  164.         MakeMeStop();
  165.         StartCutscene(1);
  166.  
  167.         if (camexists == 0)
  168.         {
  169.             cam1spot = CreateThing(tpl_ghost, player);
  170.             CaptureThing(cam1spot);
  171.             cam1look = CreateThing(tpl_ghost, player);
  172.             CaptureThing(cam1look);
  173.             camexists = 1;
  174.         }
  175.         SetCameraLookInterp(2, 0);
  176.         SetCameraPosInterp(2, 0);
  177.         MakeCamera2LikeCamera1(cam1spot, cam1look);
  178.         SetCameraFocus(2, cam1spot);
  179.         SetCameraSecondaryFocus(2, cam1look);
  180.         SetCurrentCamera(2);
  181.         ResetCameraFOV(0, 0.0);
  182.         SetCameraLookInterp(2, 1);
  183.         SetCameraPosInterp(2, 1);
  184.         SetCameraInterpSpeed(2, 0.8);
  185.         Sleep(0.01);
  186.         SetCameraFocus(2, head1_cam);
  187.         SetCameraSecondaryFocus(2, head1_ct_1);
  188.  
  189.         rel = PlaySoundThing(release, head1a, 1, 20, 25, 0);
  190.         SetThingLook(player, lookvec);
  191.         track = PlayKey(player, in_Stand4, 2, 0x0, 0);
  192.         PlayKey(player, in_1to4, 4, 0x12, 1);
  193.         waitforsound(rel);
  194.         sleep(0.4);
  195.         talk = PlayVoice(player, plyersnd, 1.0, 1);
  196.         waitforsound(talk);
  197.         StopKey(player, track, 0.5);
  198.         Sleep(0.5);
  199.  
  200.         SetCameraPosition(1, GetThingPos(head1_cam));
  201.         SetCurrentCamera(1);
  202.  
  203.         ClearActorFlags(player, 0x200000);
  204.         EndCutscene();
  205.  
  206.         return;
  207.     }
  208.  
  209.     if ((getsenderRef() == safeslot) && (rolled == 1))
  210.     {
  211.         rolled=2;
  212.         curcam = GetCurrentCamera();
  213.         SetThingFlags(player, 0x80000);
  214.         SetActorFlags(player, 0x200000);
  215.         MakeMeStop();
  216.         StartCutscene(1);
  217.         SetCollideType(head1a, 0);
  218.         SetCameraLookInterp(2, 0);            #snap camera in place.
  219.         SetCameraPosInterp(2, 0);
  220.         SetCameraFocus(2, campos2);
  221.         SetCameraSecondaryFocus(2, head1a);
  222.         SetCurrentCamera(2);
  223.         setTimer(2.5); # was 1.5
  224.  
  225.         return;
  226.     }
  227.  
  228.     return;
  229.  
  230. # ..............................................................................
  231.  
  232. touched:
  233.  
  234.     if ((rolled == 0) || (rolled == 3))
  235.     {
  236.         return;
  237.     }
  238.  
  239.     if ((GetSenderRef() == head1a) && (GetSourceRef() == player))
  240.     {
  241.         ClearActorFlags(player, 0x8);
  242.         DamageThing(player, 1000.0, 0x1, victim);
  243.         SetCollideType(head1a, 0);
  244.         PlaySoundLocal(Death, 1.0, 0.0, 0x0, 0);
  245.         PlayKey(player, smashed, 10, 0x14, 0);
  246.         tutch=1;
  247.     }
  248.  
  249.     return;
  250.  
  251. # ..............................................................................
  252.  
  253. exited:
  254.  
  255.     if ((getsenderref() == tube0) && (rolled == 0))
  256.     {
  257.         rolled=1;
  258.         rel = PlaySoundThing(release, head1a, 1, 20, 25, 0);
  259.         waitforsound(rel);
  260.         PlayVoice(player, ungh, 1.0, 0);
  261.         rollin = PlaySoundThing(headroll, head1a, 1, 20, 55, 0x0081);
  262.         MoveThingToPos(head1a, vec1, 0.2);
  263.         rollhead = PlayKey(head1a, rolling, 4, 0x10, 0);
  264.         SetThingMoveSize(head1a, 0.1);
  265.         sleep(0.2);
  266.  
  267.         if (tutch == 0)
  268.         {    
  269.             SetCollideType(head1a, 3);
  270.         }
  271.  
  272.         MoveThingToPos(head1a, vec2, 5.8);
  273.         sleep(5.8);
  274.         MoveThingToPos(head1a, vec3, 1.0);
  275.         sleep(1.0);
  276.         StopKey(head1a, rollhead, 0.5);
  277.         StopSound(rollin, 0);
  278.         PlaySoundThing(headland, head1a, 1, 20, 55, 0);
  279.         DestroyThing(head1a);
  280.         ClearThingFlags(head1b, 0x80000);
  281.         MoveThingToPos(head1b, vec4, 1.0);
  282.         rollhead = PlayKey(head1b, rolling, 4, 0x14, 0);
  283.         StopKey(head1b, rollhead, 1.0);
  284.         sleep(1.0);
  285.  
  286.         if (rolled == 2)
  287.         {
  288.             sleep(1.5);
  289.             call camera_end;
  290.         }
  291.  
  292.         rolled=3;
  293.         SendMessageEx(hints, user0, 2, 0, 0, 0);    #param0=2; rock head on valley floor.
  294.     }
  295.  
  296.     return;
  297.  
  298. # ..............................................................................
  299.  
  300. timer:
  301.  
  302.     if (rolled == 3)
  303.     {    
  304.         return;
  305.     }
  306.  
  307.     SetCameraFocus(2, campos);
  308.     AttachThingToThingEx(head1_ct_2, head1a, 0x0C);
  309.     SetCameraSecondaryFocus(2, head1_ct_2);
  310.     SetCameraFOV(50, 0, 0.0);
  311.     Sleep(0.01);
  312.     SetCameraFOV(90, 1, 5.0);
  313.  
  314.     return;
  315.  
  316. # ..............................................................................
  317.  
  318. blocked:
  319. #    Print("head is blocked");
  320. #    headsize=GetThingMoveSize(head1a);
  321.     SetThingMoveSize(head1a, 0.1);
  322.     return;
  323.  
  324. # ..............................................................................
  325.  
  326. pulse:
  327.  
  328.     if (doshake != 0)
  329.     {
  330.         vibe = RandBetween(1, 4);
  331.         if (vibe == 1)
  332.         {
  333.             if (shake == 1)
  334.             {
  335.                 posOffset = '-0.005 0.00 -0.001'; #1 was .005x
  336.                 angOffset = '0.00 -0.001 0.001';
  337.             }
  338.             if (shake == 2)
  339.             {
  340.                 posOffset = '0.01 -0.01 0.005'; #2
  341.                 angOffset = '0.005 0.00 -0.005';
  342.             }
  343.             if (shake == 3)
  344.             {
  345.                 posOffset = '0.01 0.02 -0.02'; #3
  346.                 angOffset = '-0.01 0.01 -0.01';
  347.             }
  348.         }
  349.         if (vibe == 2)
  350.         {
  351.             if (shake == 1)
  352.             {
  353.                 posOffset = '0.005 -0.002 0.001'; #2 was .005x
  354.                 angOffset = '0.001 0.00 -0.001';
  355.             }
  356.             if (shake == 2)
  357.             {
  358.                 posOffset = '0.005 0.01 -0.01'; #3
  359.                 angOffset = '-0.005 0.005 -0.00';
  360.             }
  361.             if (shake == 3)
  362.             {
  363.                 posOffset = '-0.02 0.00 0.02'; #4 was .01x
  364.                 angOffset = '0.00 0.00 0.01';
  365.             }
  366.         }
  367.         if (vibe == 3)
  368.         {
  369.             if (shake == 1)
  370.             {
  371.                 posOffset = '0.002 0.002 -0.002'; #3 was .002x
  372.                 angOffset = '-0.001 0.002 -0.002';
  373.             }
  374.             if (shake == 2)
  375.             {
  376.                 posOffset = '-0.015 0.00 0.01'; #4 was .01x
  377.                 angOffset = '0.00 0.00 0.01';
  378.             }
  379.             if (shake == 3)
  380.             {
  381.                 posOffset = '-0.025 0.00 -0.01'; #1 was .02x
  382.                 angOffset = '0.00 -0.01 0.01';
  383.             }
  384.         }
  385.         if (vibe == 4)
  386.         {
  387.             if (shake == 1)
  388.             {
  389.                 posOffset = '-0.001 0.00 0.002'; #4
  390.                 angOffset = '0.00 0.00 0.001';
  391.             }
  392.             if (shake == 2)
  393.             {
  394.                 posOffset = '-0.01 0.00 -0.005'; #1
  395.                 angOffset = '0.00 -0.005 0.005';
  396.             }
  397.             if (shake == 3)
  398.             {
  399.                 posOffset = '0.02 -0.02 0.01'; #2
  400.                 angOffset = '0.01 0.00 -0.01';
  401.             }
  402.         }
  403.  
  404.         vibe = RandBetween(1, 3);
  405.         if (vibe == 1)
  406.         {
  407.             SetPulse(0.05);
  408.         }
  409.         if (vibe == 2)
  410.         {
  411.             SetPulse(0.1);
  412.         }
  413.         if (vibe == 3)
  414.         {
  415.             SetPulse(0.15);
  416.         }
  417.  
  418.         SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  419.  
  420.         return;
  421.     }
  422.     else
  423.     {    
  424.         if (numpulz >= 8)
  425.         {
  426.             setpulse(0);
  427.             return;
  428.         }
  429.  
  430.         for (i=0; i<numDebris; i=i+1)                                                                        
  431.         {
  432.             rocks = CreateThing(debris0[RandBetween(0, 2)], debrispos);
  433.             SetThingVel(rocks, VectorScale(VectorAdd(RandVec(), '-0.2 0.0 -0.2'), 2));
  434.             SetThingRotVel(rocks, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 900.0));
  435.         }
  436.         numpulz = (numpulz)+1; 
  437.  
  438.         return;
  439.     }
  440.  
  441. # ..............................................................................
  442.  
  443. camera_end:
  444.  
  445.     SetCurrentCamera(curCam);
  446.     ClearThingFlags(player, 0x80000);
  447.     ClearActorFlags(player, 0x200000);
  448.     EndCutscene();
  449.     PlayVoice(player, closecall, 1.0, 0);
  450.  
  451.     return;
  452.  
  453. end
  454.